package com.shadow.study.shiro.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shadow.study.shiro.entity.ShiroPermissionEntity;
import com.shadow.study.shiro.mapper.ShiroPermissionMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

@Slf4j
@Service
public class ShiroPermissionService extends ServiceImpl<ShiroPermissionMapper, ShiroPermissionEntity> implements IService<ShiroPermissionEntity> {

    @Resource
    private ShiroPermissionMapper shiroPermissionMapper;

    public List<ShiroPermissionEntity> selectByUserId(final Long userId) {
        if (Objects.nonNull(userId)) {
            return shiroPermissionMapper.selectByUserId(userId);
        }
        return Collections.emptyList();
    }


}
